package com.example.forum.dao;

import com.example.forum.domain.LoginTicket;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface LoginTicketDao {
    //增加一个loginTicket
    @Insert("insert into login_ticket values(null,#{userId},#{ticket},#{status},#{expired})")
    public void addLoginTicket(LoginTicket loginTicket);

    //根据ticket查询一个LoginTicket
    @Select("select * from login_ticket where ticket=#{ticket}")
    public LoginTicket findByTicket(String ticket);

    //改变一个LoginTicket的status
    @Update("update login_ticket set status=#{status} where ticket=#{ticket}")
    public void updateLoginTicket(String ticket,int status);
}
